/*
@author Aurelien Deharbe

This file is part of Cute-Client.

Cute-Client is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Cute-Client is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with Cute-Client.  If not, see <http://www.gnu.org/licenses/>.
*/

package com.cuteserver.client.examples;

import com.cuteserver.client.CSClient;
import com.cuteserver.client.CSException;
import com.cuteserver.client.CSICallback;
import com.cuteserver.client.CSSession;

public class Example04Cli3 implements CSICallback {

	public static void main(String[] args)
	{
		try {
			CSClient c = new CSClient("localhost", 5000);
			CSSession s = c.joinSession("example04");
			
			CSICallback ex = new Example04Cli3();
			s.registerCallback("<<win>.*QPushButton>", "clicked", ex);
			
			s.mainloop();
		}
		catch(CSException e) {
			e.print();
		}
	}
	
	public void callback(String sender, Object[] args) {
		if (sender.equals("<btn3>")) {
			System.exit(0);
		} else {
			System.out.println("button clicked !");
		}
	}
}
